<?php
/*========================================= JooSam =========================================/
/																							/
/	Extention:		JooSam																	/
/	Created by:		ScriptPlanet.eu															/
/	Site:			http://www.scriptplanet.eu												/
/	Email:			support@scriptplanet.eu													/
/	Support:		http://www.scriptplanet.eu/support										/
/	Copyright:		2011 (c) ScriptPlanet.eu												/
/	License:		CC BY-NC-ND 3.0 ~ http://creativecommons.org/licenses/by-nc-nd/3.0/		/
/	File Version:	0001																	/
/																							/
/========================================== JooSam ========================================*/
// Make sure only joomla access this page
defined('_JEXEC') or die;
 
// import Joomla view library
jimport('joomla.application.component.view');
 
/**
 * HelloWorld View
 */
class JooSamViewSetting extends JView
{
	protected $form;
	protected $item;
	/**
	 * display method of Hello view
	 * @return void
	 */
	public function display($tpl = null) 
	{
		// get the Data
		$form = $this->get('Form');
		$item = $this->get('Item');
 
		// Check for errors.
		if (count($errors = $this->get('Errors'))) 
		{
			JError::raiseError(500, implode('<br />', $errors));
			return false;
		}
		// Assign the Data
		$this->form = $form;
		$this->item = $item;
		$this->form->setValue('password', NULL);
		// Set the toolbar
		$this->addToolBar();
		$this->setDocument();
 
		// Display the template
		parent::display($tpl);
	}
 
	/**
	 * Setting the toolbar
	 */
	protected function addToolBar(){
		JRequest::setVar('hidemainmenu', true);
		$canDo	= JoosamHelper::getActions();
		JToolBarHelper::title(JText::_('COM_JOOSAM_VIEW_SETTINGS_TITLEBAR'), 'settings-title-logo'); // build the toolbar with name (Main)
		if ($canDo->get('core.edit')) {
			JToolBarHelper::save('setting.save');
		}
		JToolBarHelper::cancel('setting.cancel');
	}

	protected function setDocument() {
		// set title and css
		$document = JFactory::getDocument();
		$document->setTitle(JText::_('COM_JOOSAM_VIEW_SETTINGS_TITLE'));
		$document->addStyleDeclaration('.icon-48-settings-title-logo{
											background-image:url(../media/com_joosam/images/settings.Title.Logo.png);
											background-position:10px 1px;
										}
										.jsamLegend{
											border-radius:10px;
										}
										.invalid {
											font-weight: normal !important;
										}
										input,label {
											margin:0 !important;
											padding0 !important;
										}');
		
	}
}

// load template